#!/bin/bash
function getdir(){
compareName='.webp';
for element in `ls $1`
do
dir_or_file=$1"/"$element
if [ -d $dir_or_file ]
then
getdir $dir_or_file
else
# echo ${dir_or_file##*.}
if [ "${dir_or_file##*.}" = "webp" ]
then
echo "=========="
newname=${dir_or_file%.*}
dwebp $dir_or_file -o ${newname}".png" 
rm -f $dir_or_file
echo "dwebp转换 "${dir_or_file}" 到 "${newname}
fi
fi
done
}
root_dir=$(cd $(dirname $0); pwd)
echo $root_dir
getdir $root_dir
